home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Tool Chest / Development Kits / MPW etc. / MPW-GM / Interfaces&Libraries / Interfaces / CIncludes / Aliases.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-17  |  6.2 KB  |  201 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Aliases.h
  3.  
  4.      Contains:    Alias Manager Interfaces.
  5.  
  6.      Version:    Technology:    Mac OS 8.1
  7.                  Release:    Universal Interfaces 3.1
  8.  
  9.      Copyright:    © 1989-1995, 1997-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __ALIASES__
  19. #define __ALIASES__
  20.  
  21. #ifndef __MACTYPES__
  22. #include <MacTypes.h>
  23. #endif
  24. #ifndef __APPLETALK__
  25. #include <AppleTalk.h>
  26. #endif
  27. #ifndef __FILES__
  28. #include <Files.h>
  29. #endif
  30.  
  31.  
  32.  
  33. #if PRAGMA_ONCE
  34. #pragma once
  35. #endif
  36.  
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40.  
  41. #if PRAGMA_IMPORT
  42. #pragma import on
  43. #endif
  44.  
  45. #if PRAGMA_STRUCT_ALIGN
  46.     #pragma options align=mac68k
  47. #elif PRAGMA_STRUCT_PACKPUSH
  48.     #pragma pack(push, 2)
  49. #elif PRAGMA_STRUCT_PACK
  50.     #pragma pack(2)
  51. #endif
  52.  
  53.  
  54. enum {
  55.     rAliasType                    = FOUR_CHAR_CODE('alis')        /* Aliases are stored as resources of this type */
  56. };
  57.  
  58.  
  59. enum {
  60.                                                                 /* define alias resolution action rules mask */
  61.     kARMMountVol                = 0x00000001,                    /* mount the volume automatically */
  62.     kARMNoUI                    = 0x00000002,                    /* no user interface allowed during resolution */
  63.     kARMMultVols                = 0x00000008,                    /* search on multiple volumes */
  64.     kARMSearch                    = 0x00000100,                    /* search quickly */
  65.     kARMSearchMore                = 0x00000200,                    /* search further */
  66.     kARMSearchRelFirst            = 0x00000400                    /* search target on a relative path first */
  67. };
  68.  
  69.  
  70. enum {
  71.                                                                 /* define alias record information types */
  72.     asiZoneName                    = -3,                            /* get zone name */
  73.     asiServerName                = -2,                            /* get server name */
  74.     asiVolumeName                = -1,                            /* get volume name */
  75.     asiAliasName                = 0,                            /* get aliased file/folder/volume name */
  76.     asiParentName                = 1                                /* get parent folder name */
  77. };
  78.  
  79. /* ResolveAliasFileWithMountFlags options */
  80.  
  81. enum {
  82.     kResolveAliasFileNoUI        = 0x00000001                    /* no user interaction during resolution */
  83. };
  84.  
  85. /* define the alias record that will be the blackbox for the caller */
  86.  
  87. struct AliasRecord {
  88.     OSType                             userType;                    /* appl stored type like creator type */
  89.     unsigned short                     aliasSize;                    /* alias record size in bytes, for appl usage */
  90. };
  91. typedef struct AliasRecord                AliasRecord;
  92.  
  93. typedef AliasRecord *                    AliasPtr;
  94. typedef AliasPtr *                        AliasHandle;
  95. /* alias record information type */
  96. typedef short                             AliasInfoType;
  97. /*  create a new alias between fromFile-target and return alias record handle  */
  98. EXTERN_API( OSErr )
  99. NewAlias                        (ConstFSSpecPtr         fromFile,
  100.                                  const FSSpec *            target,
  101.                                  AliasHandle *            alias)                                TWOWORDINLINE(0x7002, 0xA823);
  102.  
  103. /* create a minimal new alias for a target and return alias record handle */
  104. EXTERN_API( OSErr )
  105. NewAliasMinimal                    (const FSSpec *            target,
  106.                                  AliasHandle *            alias)                                TWOWORDINLINE(0x7008, 0xA823);
  107.  
  108. /* create a minimal new alias from a target fullpath (optional zone and server name) and return alias record handle  */
  109. EXTERN_API( OSErr )
  110. NewAliasMinimalFromFullPath        (short                     fullPathLength,
  111.                                  const void *            fullPath,
  112.                                  ConstStr32Param         zoneName,
  113.                                  ConstStr31Param         serverName,
  114.                                  AliasHandle *            alias)                                TWOWORDINLINE(0x7009, 0xA823);
  115.  
  116. /* given an alias handle and fromFile, resolve the alias, update the alias record and return aliased filename and wasChanged flag. */
  117. EXTERN_API( OSErr )
  118. ResolveAlias                    (ConstFSSpecPtr         fromFile,
  119.                                  AliasHandle             alias,
  120.                                  FSSpec *                target,
  121.                                  Boolean *                wasChanged)                            TWOWORDINLINE(0x7003, 0xA823);
  122.  
  123. /* given an alias handle and an index specifying requested alias information type, return the information from alias record as a string. */
  124. EXTERN_API( OSErr )
  125. GetAliasInfo                    (AliasHandle             alias,
  126.                                  AliasInfoType             index,
  127.                                  Str63                     theString)                            TWOWORDINLINE(0x7007, 0xA823);
  128.  
  129.  
  130. /* 
  131.   Given a file spec, return target file spec if input file spec is an alias.
  132.   It resolves the entire alias chain or one step of the chain.  It returns
  133.   info about whether the target is a folder or file; and whether the input
  134.   file spec was an alias or not. 
  135. */
  136. EXTERN_API( OSErr )
  137. ResolveAliasFile                (FSSpec *                theSpec,
  138.                                  Boolean                 resolveAliasChains,
  139.                                  Boolean *                targetIsFolder,
  140.                                  Boolean *                wasAliased)                            TWOWORDINLINE(0x700C, 0xA823);
  141.  
  142.  
  143. EXTERN_API( OSErr )
  144. FollowFinderAlias                (ConstFSSpecPtr         fromFile,
  145.                                  AliasHandle             alias,
  146.                                  Boolean                 logon,
  147.                                  FSSpec *                target,
  148.                                  Boolean *                wasChanged)                            TWOWORDINLINE(0x700F, 0xA823);
  149.  
  150. /* 
  151.    Low Level Routines 
  152. */
  153. /* given a fromFile-target pair and an alias handle, update the lias record pointed to by alias handle to represent target as the new alias. */
  154. EXTERN_API( OSErr )
  155. UpdateAlias                        (ConstFSSpecPtr         fromFile,
  156.                                  const FSSpec *            target,
  157.                                  AliasHandle             alias,
  158.                                  Boolean *                wasChanged)                            TWOWORDINLINE(0x7006, 0xA823);
  159.  
  160.  
  161. typedef CALLBACK_API( Boolean , AliasFilterProcPtr )(CInfoPBPtr cpbPtr, Boolean *quitFlag, Ptr myDataPtr);
  162. typedef STACK_UPP_TYPE(AliasFilterProcPtr)                         AliasFilterUPP;
  163. enum { uppAliasFilterProcInfo = 0x00000FD0 };                     /* pascal 1_byte Func(4_bytes, 4_bytes, 4_bytes) */
  164. #define NewAliasFilterProc(userRoutine)                         (AliasFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppAliasFilterProcInfo, GetCurrentArchitecture())
  165. #define CallAliasFilterProc(userRoutine, cpbPtr, quitFlag, myDataPtr)  CALL_THREE_PARAMETER_UPP((userRoutine), uppAliasFilterProcInfo, (cpbPtr), (quitFlag), (myDataPtr))
  166.  
  167. /*  Given an alias handle and fromFile, match the alias and return aliased filename(s) and needsUpdate flag */
  168. EXTERN_API( OSErr )
  169. MatchAlias                        (ConstFSSpecPtr         fromFile,
  170.                                  unsigned long             rulesMask,
  171.                                  AliasHandle             alias,
  172.                                  short *                aliasCount,
  173.                                  FSSpecArrayPtr         aliasList,
  174.                                  Boolean *                needsUpdate,
  175.                                  AliasFilterUPP         aliasFilter,
  176.                                  void *                    yourDataPtr)                        TWOWORDINLINE(0x7005, 0xA823);
  177.  
  178.  
  179.  
  180.  
  181. #if PRAGMA_STRUCT_ALIGN
  182.     #pragma options align=reset
  183. #elif PRAGMA_STRUCT_PACKPUSH
  184.     #pragma pack(pop)
  185. #elif PRAGMA_STRUCT_PACK
  186.     #pragma pack()
  187. #endif
  188.  
  189. #ifdef PRAGMA_IMPORT_OFF
  190. #pragma import off
  191. #elif PRAGMA_IMPORT
  192. #pragma import reset
  193. #endif
  194.  
  195. #ifdef __cplusplus
  196. }
  197. #endif
  198.  
  199. #endif /* __ALIASES__ */
  200.  
  201.